<?php
$commonConfig = require dirname(__FILE__).'/../../../common/config/main.php';

$config = array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'=>'ZY Admin',
//    'homeUrl'=>'/site/',
	// preloading 'log' component
	'preload'=>array('log'),

	// autoloading model and component classes
	'import'=>array(
		'application.models.*',
        'application.modules.*',
		'application.components.*',
        'ext.YiiMongoDbSuite.*',
	),

	'modules'=>array(
		// uncomment the following to enable the Gii tool
        'auth'=>array(
            'class'=>'application.modules.auth.AuthModule',
            'controllerPath' => ZY_BACKEND_PATH.'/modules/auth/controllers',
            'viewPath'=>ZY_BACKEND_PATH.'/modules/auth/views',
            'layoutPath'=>ZY_BACKEND_PATH.'/views/layouts',
            'userClassName'=>'AdminUser',
            'usernameFieldName'=>'username',
            'superUsername'=>'Admin',
            'entryPassword'=>'123123123',
            'afterEntryLoginedRedirect'=>array('/site/index'),
            'alwaysAllowsAfterEntryLogined'=>array(
                array('/site/login'),
                array('/site/logout'),
                array('/site/error'),
                array('/site/index'),
            ),
            'alwaysAllows'=>array(
                array('/auth/default/index'),
            ),
        ),
	),

	// application components
	'components'=>array(
        'user'=>array(
            'class'=>'backend.modules.auth.extensions.AuthWebUser.AuthWebUser',
			'allowAutoLogin'=>false,
		),
		'urlManager'=>array(
			'urlFormat'=>'path',
            'showScriptName'=>false,
		),
        'authManager'=>array(
            'class'=>'backend.modules.auth.extensions.CMongoDbAuthManager.CMongoDbAuthManager',
            'authFile'=>'admin_authmanager',
        ),
		'errorHandler'=>array(
            'errorAction'=>'site/error',
        ),
		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(
				array(
					'class'=>'CFileLogRoute',
					'levels'=>'error, warning',
				),
				// uncomment the following to show log messages on web pages
				/*
				array(
					'class'=>'CWebLogRoute',
				),
				*/
			),
		),
	),

	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	'params'=>array(
		// this is used in contact page
		'adminEmail'=>'webmaster@example.com',
	),
);

$config['import'] = array_merge($commonConfig['import'], $config['import']);
$config['components'] = array_merge($commonConfig['components'], $config['components']);
$config['params'] = array_merge($commonConfig['params'], $config['params']);
$config['modules'] = array_merge($commonConfig['modules'], $config['modules']);

return $config;